<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//用户账户表
class Users_bank_model extends CI_Model{
    function __construct() {
        parent::__construct();
        $this->table = 'users_bank';
    }
    
    function get($where){
        return $this->db->select('*')->from($this->table)->where($where)->order_by('create_time desc')->get()->row_array();
    }
    
    function get_list($where,$page,$limit){
        return $this->db->select('*')->from($this->table)->where($where)->order_by('create_time desc')->limit($limit,$page)->get()->result_array();
    }
    
    function insert($data){
        $this->db->insert($this->table, $data);
        if($this->db->affected_rows()){
            return $this->db->insert_id();
        }else{
            return 0;
        }
    }
    
    function update($data,$id){
        return $this->db->where('id',$id)->update($this->table, $data);
    }
    
    
    function delete($where){
        $this->db->where($where);
        $this->db->delete($this->table);
        return $this->db->affected_rows();
    }
    
    
    
}
